package com.itheima.d11_observer2;

import java.util.HashSet;
import java.util.Observable;
import java.util.Set;

/**
 * 具备被观察者
 */
public class Home extends Observable /*jdk提供的被观察者父类*/{

    private double price;

    public Home(double price) {
        this.price = price;
    }

    public double getPrice() {
        return price;
    }

    //修改房价
    public void setPrice(double price) {
        this.price = price;

        this.setChanged(); //标识当前状态已经改变
        this.notifyObservers(price); //通知所有观察者

    }


}
